﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Webbshop.ServiceReference1;

namespace Webbshop
{
    public partial class Administrator : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ShoppeServiceClient proxy = new ShoppeServiceClient();
                images.DataSource = proxy.getCategorys();
                images.DataBind();
                categorys.DataSource = proxy.getAllImages();
                categorys.DataBind();
                proxy.Close();
            }
        }

        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            ShoppeServiceClient proxy = new ShoppeServiceClient();

            proxy.addNewProduct(
                productNameBox.Text,
                imageIDBox.Text, 
                productDescriptionBox.Text, 
                Int16.Parse(stockStatusBox.Text),
                cateGoryIdBox.Text,
                Int16.Parse(priceBox.Text));
        }
    }
}